import time
def b(a,N):
    for i in range(N-1):
        for j in range(N-i-1):
            if a[j]>a[j+1]:
                a[j],a[j+1]=a[j+1],a[j]

def r(filename):
    file=open(filename,"r")
    data=file.readlines()
    return data
m1=r("m1_sorted.txt")
LEN1=len(m1)
t_start=time.time()
b(m1,LEN1)
t_finish=time.time()
print("m1_sorted",round((t_finish-t_start)*1000),"milliseconds")

m2=r("m2_reverse.txt")
LEN2=len(m2)
t_start=time.time()
b(m2,LEN2)
t_finish=time.time()
print("m2_reverse",round((t_finish-t_start)*1000),"milliseconds")

m3=r("m3_shuffle.txt")
LEN3=len(m3)
t_start=time.time()
b(m3,LEN3)
t_finish=time.time()
print("m3_shuffle",round((t_finish-t_start)*1000),"milliseconds")
